package com.springboot.controller;

import com.springboot.config.DbProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.configurationprocessor.json.JSONObject;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@Controller
@RequestMapping("a")
public class DemoController {
    @Autowired

    private DbProperties dbProperties;
    @RequestMapping("b")
    @ResponseBody
    public  Map<String, Object> add(){
        Map<String, Object> map = new HashMap<>();
        map.put("username",dbProperties.getUsername());
        map.put("password",dbProperties.getPassword());
        return map;
    }
}
